webp format support (Android Only) for GLContext.takeSnapshot function #7490
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why
At some point (API 14), Android added native WebP support (Bitmap.CompressFormat.WEBP), so adding the option to export the render to WebP is trivial.
Creating a new module just for converting from PNG to WebP is silly since you can get the GL render as WebP directly. Also converting from PNG to WebP could create quality loss.
How
In GLContext.java, I extended the block that specifies using png (instead of jpeg, the default) to recognize webp as another posible format.
Test Plan
Sadly, a combination of living in Windows OS and lack of experience in some aspects of software development, I was not able to test this change using the proper methods (unit test, and that). But I did tried the change in the App I'm building and it worked fine
Thanks for your attention, sorry for any mistake in the PR, this is the second time I do a PR